package cn.itcast.dao;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Properties;

import org.junit.Test;

import cn.itcast.context.ServletContextDemo7;
/***
 * 测试不通
 * @author Administrator
 *
 */
public class Dao {
	//读取资源文件，并更新资源文件
		public void run() throws IOException{
			//获取到装载当前类的类装载器  
			ClassLoader loader = this.getClass().getClassLoader();
			
			//用类装载器装载db.properties文件
			InputStream in = loader.getResourceAsStream("db1.properties");
			Properties prop = new Properties();
			prop.load(in);
			
			String driver = prop.getProperty("driver");
			String url = prop.getProperty("url");
			String username = prop.getProperty("username");
			String password = prop.getProperty("password");
			
			System.out.println(driver);
			
			System.out.println(prop.size());
			
			prop.setProperty("name", "flx");
			//prop.store(out, "");
			
			

			
		}
 
	
	 
	
}
